package com.handinglian.ai.notice.controller;

import com.apidoc.annotation.Api;
import com.handinglian.ai.common.dto.ResultData;
import com.handinglian.ai.notice.dto.KeyGroupDto;
import com.handinglian.ai.notice.param.KeyGroupCreateParam;
import com.handinglian.ai.notice.param.KeyGroupUpdateParam;
import com.handinglian.ai.notice.service.KeyGroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api("按键组设置")
@RestController
@Slf4j
@RequestMapping("/keygroup")
public class KeyGroupController {
    @Autowired
    private KeyGroupService keyGroupService;
    private static List<Object> list;

    /**
     * 创建按键组
     */
    @PostMapping(value = "/create")
    public ResultData create(@RequestBody KeyGroupCreateParam createParam) {
        return ResultData.success(keyGroupService.create(createParam));
    }

    /**
     * 删除按键组
     */
    @DeleteMapping(value = "/delete")
    public ResultData delete(Integer id) {
        return ResultData.success(keyGroupService.delete(id));
    }


    /**
     * 更新按键组
     */
    @PutMapping(value = "/update")
    public ResultData update(@RequestBody KeyGroupUpdateParam updateParam) {
        return ResultData.success(keyGroupService.update(updateParam));
    }

    /**
     * 获取按键组列表
     */
    @GetMapping(value = "/list")
    public ResultData<KeyGroupDto> list() {
        return ResultData.success(keyGroupService.list());
    }

    /**
     * 获取按键组基本信息
     */
    @GetMapping(value = "/get")
    public ResultData<KeyGroupDto> get(Integer id) {
        return ResultData.success(keyGroupService.get(id));
    }
}
